<template>
  <div class="btns">
    <Button v-auth="'accomplishSign'" color="primary" @click="finishSign">完成应约</Button>
    <Button v-auth="'waitSignWaive'" color="warning" @click="surrender">放弃</Button>
  </div>


</template>

<script setup lang='ts'>
import { Button } from "@/components/Button";
import { message } from "ant-design-vue";
import { agreementSigned } from "@/api/application-details/index.ts";
import { comStores } from '@/store/common/comStore';
const store = comStores()
const { userName } = store.userInFor
// store.getResumeInfo(resumeId)

const emits = defineEmits(['surrender']);

const surrender = () => {
  console.log('surrender')
  emits('surrender', '待签应约')
}

const finishSign = async () => {
  const { resumeId, processId } = store.currentResume;
  // console.log('完成应约','finishSign')
  let param = {
    "resumeId": resumeId,
    "processId": processId,
    "result": "通过",
    "operator": userName
  }
  const data = await agreementSigned(param);
  if (data && data.code === '10000') {
    message.success("操作成功")
    await store.getResumeInfo(resumeId)
  } else {
    message.error(data.msg)
  }
}

const comfirm = () => {

}

</script>
<style lang="less" scoped>
.btns {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
</style>